<?php
declare (strict_types=1);

namespace app\controller\home;

use app\common\controller\BaseController;
use app\model\home\Game as gameModel;
use think\App;
use \Throwable;

class Game extends BaseController
{
    protected $model;

    public function __construct(App $app, gameModel $model)
    {
        parent::__construct($app);
        $this->model = $model;
    }

    /**
     * 列表查询
     * @return array
     */
    public function query()
    {
        $where = [];
        $where['status'] = 1;
        $where['store_id'] = input('store_id/d', 1);
        $page = input('page/d', 1);
        $pageSize = input('page_size/d', 20);
        $order = 'sort DESC';
        $fields = 'id,game_title,game_cover';
        return $this->model->getList($where, $fields, $order, $page, $pageSize);
    }
}
